<link rel="stylesheet" href="<?php echo NICED_URL::getCssBaseURL()."/admin/thirdparty/jquery/jquery.treeview.css"?>" />
<script type="text/javascript" src="<?php echo NICED_URL::getJsBaseURL()."/admin/thirdparty/jquery/jquery.treeview.js"?>"></script>
<div class="menu">
<?php
//get menu
$model   = $this->import('Admin.Index');
//$this->set("menu", $model->get("menu"));
$menu = $model->get("menu");

if (isset($menu) && $menu)
{
?>
    <ul class="treelist filetree">
<?php
    foreach ($menu as $k => $v)
    {
    ?>
        <li class="closed"><span class="folder"><a href="<?php echo $v["link"]."?menu_id=".$v["id"]?>"><?php echo $v["name"]?></a></span>
    <?php
        if (isset($v["child"]) && $v["child"])
        {
        ?>
        <ul>
            <?php
            foreach ($v["child"] as $child)
            {
            ?>
            <li><span><a href="<?php echo $child["link"]."?menu_id=".$child["id"]?>"><?php echo $child["name"]?></a></span></li>
            <?php
            }
            ?>
        </ul>
        <?php
        }
        ?>
        </li>
    <?php
    }
    ?>
    </ul>
<?php
}
?>
</div>
<script>
(function($){
$(document).ready(function(){
    $(".treelist").treeview({
        toggle: function() {
            console.log("%s was toggled.", $(this).find(">span").text());
        }
    });
});
})(jQuery)
</script>
